package com.yf1706.vo;

public class Information {
	private boolean success;
	private String message;
	private Object data;
	public static Information SUCCESS=new Information();

	public boolean isSuccess() {
		return success;
	}

	public void setSuccess(boolean success) {
		this.success = success;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Information() {
		this.success = true;
		this.message = "操作成功";
	}
	
	/**
	 * 失败
	 * @param message
	 */
	public static Information failure(String message){
		return new Information(false, message);
	}

	public Information(boolean success, String message) {
		super();
		this.success = success;
		this.message = message;
	}
	
	public Information(boolean success, Object data) {
		super();
		this.success = success;
		this.data = data;
	}

	public Information(boolean success, String message, Object data) {
		super();
		this.success = success;
		this.message = message;
		this.data = data;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public Information(Exception e) {
		this.success = false;
		this.message = e.getMessage();
	}

	public static Information getInstance() {
		return new Information();
	}

	public static Information getInstance(Exception e) {
		return new Information(e);
	}
}
